import Vue from 'vue'
import Vuex from 'vuex'
import {
  setStore,
  getStore,
  clearStore
} from '@/utils/store'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    vToken: getStore({
      name: 'vToken'
    }) || ''
  },
  mutations: {
    SET_vUserId: (state, vUserId) => {
      state.vUserId = vUserId;
      setStore({
        name: 'vUserId',
        content: state.vUserId
      })
    },
    Logout: (state) => {
      state.vToken = state.vVerifycode = state.vName = state.vCompany = state.vJob = state.vUserId = state.vDomains = ''
      clearStore();
    }
  },
  actions: {
  },
  getters: {
    vToken: state => state.vToken
  },
  modules: {
  }
})
